<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Profile extends CI_Controller {
	
	public function index()
	{            
            //$this->load->view('media');
            echo 'Hello World!';
	}
        public function view($profile_id)
        {            
            $this->load->model('profile_model','',TRUE);
            $this->load->model('media_model','',TRUE);
            $data['profile'] = $this->profile_model->get_profile($profile_id);            
            $data['media'] = $this->media_model->get_all_media_by_user($profile_id);
            $this->load->view('profile', $data);
        }
        public function create()
        {
            $this->load->view('create_profile');
        }
        public function logout()
        {
            $this->simplelogin->logout();
            redirect(base_url(), 'location');
        }
        public function login()
        {
            if($this->simplelogin->login($this->input->post('user_name'), hash('sha256',$this->input->post('password'))))
            {
                redirect(base_url(), 'location'); 
            }
            else
            {
                $this->load->view('login_profile');
            }
        }
        public function save()
        {
            $this->load->model('profile_model','',TRUE);
            $this->profile_model->create_profile();  
            redirect(base_url(), 'location');  
        }
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */